/*
 ============================================================================
 Name        : MC.c
 Author      : Cheng
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int iseed, equil, prod, nsamp, ii, icycl, ndispl, attempt, nacc, ncycl, nmoves, imove;
	double en, ent, vir, virt, dr;
	printf("**************** MC_NVT ***************\n");
	//initialize sysem
	READDAT(equil, prod, nsamp, ndispl, dr, iseed);
	nmoves = ndispl;
	//total energy of the system
	TOTERG(en, vir);
	printf("**************** En_Vir ***************\n");
	//start MC-cycle
	for (ii = 1; i <=2; i++){
		if (ii == 1){
			ncycl = equil;
			if (ncycle != 0)
				prinf("Start equilibration\n");
		}
		else{
			if (ncycle != 0)
				prinf("Start equilibration\n");
		}
	}
	attempt = 0;
	nacc = 0;
	//intialize the subroutine that adjust the maximum displacement
	ADJUST(attempt, nacc, dr);
	for (icycl = 1; icycl <=ncycl; icycl ++){
		for (imove = 1; imove <= nmoves; imove++){
			//attempt to displace a particle
			MCMOVE(en, vir, attempt, nacc, dr, iseed);
		}
		if (ii == 2){
			//sample averages
			if (MOD(icycl, nsamp) == 0)
				SAMPLE(icycl, en, vir);
		}

		}
	}


	return EXIT_SUCCESS;
}
